	.file	"mytest.c"
	.globl	ticket
	.data
	.align 4
	.type	ticket, @object
	.size	ticket, 4
ticket:
	.long	100
	.section	.rodata
	.align 8
.LC0:
	.string	"thread %ld get a ticket, the number of remaining is %d\n"
	.text
	.globl	get_tickets
	.type	get_tickets, @function
get_tickets:
.LFB2:
	.cfi_startproc
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
.L5:
	movl	ticket(%rip), %eax
	testl	%eax, %eax
	jle	.L2
	movl	$1000, %edi
	call	usleep
	movl	ticket(%rip), %eax
	subl	$1, %eax
	movl	%eax, ticket(%rip)
	movl	ticket(%rip), %edx
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	movl	$.LC0, %edi
	movl	$0, %eax
	call	printf
	jmp	.L5
.L2:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	get_tickets, .-get_tickets
	.globl	main
	.type	main, @function
main:
.LFB3:
	.cfi_startproc
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	$0, -8(%rbp)
	jmp	.L8
.L9:
	movq	-8(%rbp), %rax
	addq	$1, %rax
	movq	-8(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	-48(%rbp), %rdx
	leaq	(%rdx,%rcx), %rdi
	movq	%rax, %rcx
	movl	$get_tickets, %edx
	movl	$0, %esi
	call	pthread_create
	addq	$1, -8(%rbp)
.L8:
	cmpq	$4, -8(%rbp)
	jle	.L9
	movq	$0, -8(%rbp)
	jmp	.L10
.L11:
	movq	-8(%rbp), %rax
	movq	-48(%rbp,%rax,8), %rax
	movl	$0, %esi
	movq	%rax, %rdi
	call	pthread_join
	addq	$1, -8(%rbp)
.L10:
	cmpq	$4, -8(%rbp)
	jle	.L11
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	main, .-main
	.ident	"GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-44)"
	.section	.note.GNU-stack,"",@progbits
